<template>
	<view class="updatePage">
		<view class="title">
			设置{{title}}
		</view>
		<view class="inputBorder">
			<uni-easyinput style="height: 40px;line-height: 40px;" :inputBorder="false" v-model="value" :type="type"
				placeholder="请在此进行输入"></uni-easyinput>
		</view>
		<button class="finsh" @click="finsh">完成</button>
	</view>
</template>

<script>
	import WXBizDataCrypt from '@/utils/WXBizDataCrypt.js'
	const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
	export default {
		data() {
			return {
				value: '',
				type: '',
				title: '',
				key: ''
			}
		},
		onLoad(options) {
			console.log(options);
			this.value = options.value
			this.type = options.type
			this.title = options.title
			this.key = options.key
		},
		methods: {
			// 完成
			finsh() {
				if (!this.value) {
					uni.showToast({
						icon: 'none',
						title: '请输入后再点击完成'
					})
					return
				}
				let userInfo = uni.getStorageSync('userInfo')
				userInfo[this.key] = this.value
				this.$http('Base_Manage/Base_VIPUserInfo/SaveData', userInfo).then(res => {
					if (res.Success) {
						uni.setStorageSync('userInfo', userInfo)
						uni.navigateBack()
					}
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	/deep/.uni-easyinput__content-input {
		height: 40px;
	}

	.updatePage {
		box-sizing: border-box;
		height: 100vh;
		padding: 30px;

		.title {
			font-weight: 500;
			font-size: 24px;
			text-align: center;
			margin-bottom: 10vh;
		}

		.inputBorder {
			height: 40px;
			border-top: 1px solid #ccc;
			border-bottom: 1px solid #ccc;
		}

		.finsh {
			position: absolute;
			bottom: 100px;
			left: 30px;
			width: calc(100% - 60px);
		}
	}
</style>